package com.shoppingmall.activity.mine;

import android.os.Bundle;
import android.view.View;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.allen.library.SuperTextView;
import com.blankj.utilcode.util.ActivityUtils;
import com.blankj.utilcode.util.BarUtils;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.example.zyh.toolslib.base.BaseActivity;
import com.example.zyh.toolslib.widget.TitleBar;
import com.shoppingmall.R;
import com.shoppingmall.bean.ConsumeRecordBean;

import java.util.ArrayList;
import java.util.List;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * 2020/3/14
 * 描述：重消币
 */
public class MineConsumeCoinsActivity extends BaseActivity {
    @BindView(R.id.title_bar)
    TitleBar titleBar;
    @BindView(R.id.tv_remain_money)
    TextView tvRemainMoney;
    @BindView(R.id.tv_charge_money)
    TextView tvChargeMoney;
    @BindView(R.id.rl_top)
    RelativeLayout rlTop;
    @BindView(R.id.rv_content_list)
    RecyclerView rvContentList;

    private List<ConsumeRecordBean> mData = new ArrayList<>();
    private BaseQuickAdapter<ConsumeRecordBean, BaseViewHolder> mAdapter;

    @Override
    protected int initLayout() {
        return R.layout.activity_mine_consume_coins;
    }

    @Override
    protected void initView() {
        BarUtils.setNavBarLightMode(this,false);
    }

    @Override
    protected void initData() {
        for (int i = 0; i < 5; i++) {
            mData.add(new ConsumeRecordBean("消费", "11-01 15:33", "+50"));
        }
        mAdapter = new BaseQuickAdapter<ConsumeRecordBean, BaseViewHolder>(R.layout.item_mine_consume_record, mData) {
            @Override
            protected void convert(@NonNull BaseViewHolder helper, ConsumeRecordBean item) {
                SuperTextView superTextView = (SuperTextView) helper.itemView;
                superTextView.setLeftTopString(item.getTitle());
                superTextView.setLeftBottomString(item.getTime());
                superTextView.setRightString(item.getMoney());
            }
        };

        rvContentList.setLayoutManager(new LinearLayoutManager(mContext));
        rvContentList.setAdapter(mAdapter);
    }

    @Override
    protected void initEvent() {
        titleBar.setLeftLayoutClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });
        tvChargeMoney.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                ActivityUtils.startActivity(ChargeConsumeCoinsActivity.class);
            }
        });
    }


}
